package cn.anzhiyublog.staranimegallery.model.enums;

import lombok.Getter;

/**
 * 角色枚举
 *
 * @author 安知一只鱼
 */
@Getter
public enum Role {
    USER(0, "普通用户"),
    VIP(1,"会员用户"),
    ADMIN(10, "管理员"),
    SUPER(11,"超级管理员");

    private final Integer code;
    private final String description;

    Role(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static Role getEnumByCode(Integer code) {
        for (Role role : Role.values()) {
            if (role.getCode().equals(code)) {
                return role;
            }
        }
        return null;
    }
}
